//用于json-server操作
//json-server xxx.json
//json-server xxx.js

// module.exports=()=>{
//     return{
//         data:[
//             {
//                 "id|+1":1
//             }
//         ]
//     }
// }

import Mock from "mockjs"

//第一个参数，传递接口请求地址，拦截这个接口网络上看不到，也可以不加参数，用一个变量接收

Mock.mock("http://localhost:3000/data",{
    "data|50-170":[
        
    {
        "name":"@cname()",
        "id|+1":1,
        "title":"@cparagraph(1, 3)",
        "image":"Random.image('200x100', '#894FC4', '#FFF', 'png', 'img')",
        "content":"@cparagraph()",
        "visit":"@natural(60, 1000000)",
        "userimg":"Random.image('200x100', '#894FC4', '#FFF', 'png', 'userimg')",
        "county":"@county(true)",
        "city":"@city()"
    }
    ],
    "hoteldata|50-170":[
        {
            "price":"@natural(99, 999)",
            "id|+1":1,
            "title":"@cparagraph(1, 3)",
            "image":"Random.image('200x100', '#894FC4', '#FFF', 'png', 'img')",
            "content":"@cparagraph()",
            "visit":"@natural(60, 1000000)",
            "county":"@county(true)",
            "city":"@city()"
        }
    ]
})
//延迟200-400毫秒请求数据
Mock.setup({
    timeout:"200-400"
})